﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BanVeXemPhim_Presentation
{
    public enum IdCuaSo
    {
        CUASOQUANLYPHIM,
        CUASOQUANLYRAPCHIEU,
        CUASOQUANLYNHANVIEN,
        CUASOTHONGKEDOANHTHU,
        CUASOTHONGKEKETQUALAMVIEC,
        CUASOXEPLICHCHIEU,
        CUASOTHEMDOITUONGMUA,
        CUASOTHIETLAPGIAVE
    }
    public partial class FormMHAdmin : Form
    {
        
        public FormMHAdmin()
        {
            InitializeComponent();
        }

        private FormMHChinh _manHinhChinh;
        private RapChieuDTO[] dsRapChieu;
        private PhimDTO[] dsPhim;        

        public FormMHChinh ManHinhChinh
        {
            get { return _manHinhChinh; }
            set { _manHinhChinh = value; }
        }

        private void buttonLogout_Click(object sender, EventArgs e)
        {
            this.ManHinhChinh.ShowMHDangNhap();
            this.Hide();
            this.Dispose();
        }


        //mở cửa sổ quản lý phim
        private void userControlMenuAdmin1_EventQuanLyPhim()
        {
            ShowCuaSo(IdCuaSo.CUASOQUANLYPHIM);
        }


        //mở của sổ quản lý rap chiếu
        private void userControlMenuAdmin1_EventQuanLyRapChieu()
        {
            ShowCuaSo(IdCuaSo.CUASOQUANLYRAPCHIEU);
        }


        //Mở của sổ thống kê doanh thu
        private void userControlMenuAdmin1_EventThongKeDoanhThu()
        {
            ShowCuaSo(IdCuaSo.CUASOTHONGKEDOANHTHU);
        }

        //Mở của sổ thống kê kết quả làm việc
        private void userControlMenuAdmin1_EventThongKeKetQuaLamViec()
        {
            ShowCuaSo(IdCuaSo.CUASOTHONGKEKETQUALAMVIEC);
        }

        //mở của sổ quản lý nhân viên
        private void userControlMenuAdmin1_EventQuanLyNhanVien()
        {
            ShowCuaSo(IdCuaSo.CUASOQUANLYNHANVIEN);
        }

        public void ShowCuaSo(IdCuaSo cuaso)
        {
            this.userControlAdminQuanLyPhim1.Visible = (cuaso == IdCuaSo.CUASOQUANLYPHIM);
            this.userControlAdminQuanLyRapChieu1.Visible = (cuaso == IdCuaSo.CUASOQUANLYRAPCHIEU);
            this.userControlAdminQuanLyNhanVien1.Visible = (cuaso == IdCuaSo.CUASOQUANLYNHANVIEN);
            this.userControlAdminThongKeDoanhThu1.Visible = (cuaso == IdCuaSo.CUASOTHONGKEDOANHTHU);
            this.userControlAdminThongKeKetQuaLamViec1.Visible = (cuaso == IdCuaSo.CUASOTHONGKEKETQUALAMVIEC);
            this.userControlAdminXepLichChieu1.Visible = (cuaso == IdCuaSo.CUASOXEPLICHCHIEU);
            this.userControlAdminThietLapMucVe1.Visible = (cuaso == IdCuaSo.CUASOTHIETLAPGIAVE);
            this.userControlAdminThemDoiTuong1.Visible = (cuaso == IdCuaSo.CUASOTHEMDOITUONGMUA);

        }

        private void userControlMenuAdmin1_EventXepLichChieu()
        {
            this.userControlAdminXepLichChieu1.DsPhim = dsPhim;
            this.userControlAdminXepLichChieu1.DsRapChieu = dsRapChieu;
            ShowCuaSo(IdCuaSo.CUASOXEPLICHCHIEU);
        }

        private void userControlMenuAdmin1_EventThietLapMucGia()
        {
            ShowCuaSo(IdCuaSo.CUASOTHIETLAPGIAVE);
        }

        private void userControlMenuAdmin1_EventThemDoiTuongMua()
        {
            ShowCuaSo(IdCuaSo.CUASOTHEMDOITUONGMUA);
        }

        private void FormMHAdmin_Load(object sender, EventArgs e)
        {
            PhimControl phimControl=new PhimControl();
            RapChieuControl rapChieuControl=new RapChieuControl();
            dsPhim = phimControl.LayDanhSachPhim();
            dsRapChieu = rapChieuControl.DanhSachRapChieu();
            this.userControlAdminXepLichChieu1.DsPhim = dsPhim;
            this.userControlAdminXepLichChieu1.DsRapChieu = dsRapChieu;
        }

    }
}
